<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<s:if test="#request.customer==null">
	<s:action name="showCustomerAbook"></s:action>
</s:if>
<script type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
	//var count = 0;
	//var sz = [{'type':'性别','id':'addressBook.DDLByTypeSex.typeId'},{'type':'部门','id':'addressBook.DDLByTypeDepartments.typeId'},{'type':'职务','id':'addressBook.DDLByTypeDutiesname.typeId'}];

	$(document)
			.ready(
					/**
					 *获取性别的json
					 **/
					function() {
						$
								.getJSON(
										"byTypeDDL.action",
										{
											"ddl.typeType" : "性别"
										},
										function(result) {
											var str = "";
											for ( var i = 0; i < result.length; i++) {
												str += '<input type="radio" + value="'+result[i].id+'" name="addressBook.DDLByTypeSex.typeId" >'
														+ result[i].value
														+ ''
														+ "&nbsp;&nbsp;&nbsp;&nbsp;";
											}
											$("#sex").append(str);

										});
						/**
						 *获取部门的json
						 **/
						$
								.getJSON(
										"byTypeDDL.action",
										{
											"ddl.typeType" : "部门"
										},
										function(result2) {
											var str = "<select name='addressBook.DDLByTypeDepartments.typeId'><option value=''>==请选择部门==</option>";
											for ( var i = 0; i < result2.length; i++) {
												str += '<option value="'+result2[i].id+'">'
														+ result2[i].value
														+ '</option>';
											}
											str += '</select>';
											$("#departement").append(str);

										});
						/**
						 *获取职务json
						 **/
						$
								.getJSON(
										"byTypeDDL.action",
										{
											"ddl.typeType" : "职务"
										},
										function(result1) {
											var str = "<select name='addressBook.DDLByTypeDutiesname.typeId'><option value=''>==请选择职务==</option>";
											for ( var i = 0; i < result1.length; i++) {
												str += '<option value="'+result1[i].id+'">'
														+ result1[i].value
														+ '</option>';
											}
											str += '</select>';
											$("#dutiesName").append(str);

										});

					});

	/*function hd(){
		if(count<sz.length){
			getDDL(sz[count].type,sz[count].id);
			setTimeout('hd()',100);
		}
		
	}
	
	
	function getDDL(type,id){
		 $.getJSON("byTypeDDL.action",{"ddl.typeType":type,"date":date.getTime()},function(data){
		 
			 var str = "<select name='"+id+"'><option value=''>==请选择==</option>";
			 for ( var i = 0; i < data.length; i++) {
				 str+='<option>'+data[i].value+'</option>';
			 }
			 
		 });
		
		
	}
	 */
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加通讯录</title>
<link href="../css/table.css" rel="stylesheet" type="text/css">
</head>
<body>

	<h1>通讯录操作</h1>

	<s:if test="#request.one==null">
		<form action="saveAbook.action" method="post">
			<table width="550" border="1">
				<tr>
					<td class="table_rightf">编号</td>
				  <td class="tableleftf"><input name="addressBook.abProid"></td>
				</tr>


				<s:select list="#request.customer" listKey="custCid"
					name="addressBook.customer.custCid" listValue="custName"
					headerKey="" headerValue="===请选择===" label="客户" theme="simple"></s:select>

				<tr>
					<td class="table_rightf">性别</td>
					<td class="tableleftf" id="sex"></td>
				</tr>

				<tr>
					<td class="table_rightf">客户所属部门</td>
					<td class="tableleftf" id="departement"></td>
				</tr>

				<tr>
					<td class="table_rightf">客户职务</td>
					<td class="tableleftf" id="dutiesName"></td>
				</tr>

				<tr>
					<td class="table_rightf">电话</td>
				  <td class="tableleftf"><input type="text" name="addressBook.abTellphone" /></td>
				</tr>

				<tr>
					<td class="table_rightf">邮编</td>
				  <td class="tableleftf"><input type="text" name="addressBook.abZipcode" /></td>
				</tr>
				<tr>
					<td class="table_rightf">邮箱</td>
				  <td class="tableleftf"><input type="text" name="addressBook.abEmail" /></td>
				</tr>

				<tr>
					<td class="table_rightf">QQ</td>
				  <td class="tableleftf"><input type="text" name="addressBook.abQq" /></td>
				</tr>
				<tr>
					<td class="table_rightf">联系人姓名</td>
				  <td class="tableleftf"><input type="text" name="addressBook.abProname" /></td>
				</tr>
				<tr>
					<td class="table_rightf">兴趣爱好</td>
				  <td class="tableleftf"><input type="text" name="addressBook.abInterest" /></td>
				</tr>

				<tr>
					<td class="table_rightf">生日</td>
				  <td class="tableleftf"><input readonly="readonly" name="addressBook.abBirth"
						class="Wdate" type="text" onClick="WdatePicker()" /></td>
				</tr>
				<tr>
					<td class="table_rightf">地址</td>
				  <td class="tableleftf"><input type="text" name="addressBook.abAddress" /></td>
				</tr>

				<tr>
					<td class="table_rightf">&nbsp;</td>
				  <td><input type="reset" value="重置">  	&nbsp;&nbsp;		<input type="submit" value="添加" /></td>
				</tr>
			</table>
		</form>
	</s:if>
	<s:else>


		<form action="updAbook.action" method="post">
			<table width="550" border="1">
				<tr>
					<td class="table_rightf">编号</td>
					<td class="tableleftf"> <s:property value="#request.one.abProid"/> </td>
				</tr>


				<s:select list="#request.customer" listKey="custCid"
					name="addressBook.customer.custCid" listValue="custName"
					headerKey="" headerValue="===请选择===" label="客户"></s:select>

				<tr>
					<td class="table_rightf">性别</td>
					<td class="tableleftf" id="sex"></td>
				</tr>

				<tr>
					<td class="table_rightf">客户所属部门</td>
					<td class="tableleftf" id="departement"></td>
				</tr>

				<tr>
					<td class="table_rightf">客户职务</td>
					<td class="tableleftf" id="dutiesName"></td>
				</tr>

				<tr>
					<td class="table_rightf">电话</td>
					<td class="tableleftf"><input type="text" name="addressBook.abTellphone"
						value="<s:property value="#request.one.abTellphone"/>" /></td>
				</tr>

				<tr>
					<td class="table_rightf">邮编</td>
					<td class="tableleftf"><input type="text" name="addressBook.abZipcode"
						value="<s:property value="#request.one.abZipcode"/>" /></td>
				</tr>
				<tr>
					<td class="table_rightf">邮箱</td>
					<td class="tableleftf"><input type="text" name="addressBook.abEmail"
						value="<s:property value="#request.one.abEmail"/>" /></td>
				</tr>

				<tr>
					<td class="table_rightf">QQ</td>
					<td class="tableleftf"><input type="text" name="addressBook.abQq"
						value="<s:property value="#request.one.abQq"/>" /></td>
				</tr>
				<tr>
					<td class="table_rightf">联系人姓名</td>
					<td class="tableleftf"><input type="text" name="addressBook.abProname"
						value="<s:property value="#request.one.abProname"/>" /></td>
				</tr>
				<tr>
					<td class="table_rightf">兴趣爱好</td>
					<td class="tableleftf"><input type="text" name="addressBook.abInterest"
						value="<s:property value="#request.one.abInterest"/>" /></td>
				</tr>

				<tr>
					<td class="table_rightf">生日</td>
					<td class="tableleftf"><input name="addressBook.abBirth" class="Wdate"
						type="text" onClick="WdatePicker()"
						value="<s:property value="#request.one.abBirth"/>" /></td>
				</tr>
				<tr>
					<td class="table_rightf">地址</td>
					<td class="tableleftf"><input type="text" name="addressBook.abAddress"
						value="<s:property value="#request.one.abAddress"/>" /></td>
				</tr>

				<tr>
					<td>&nbsp;</td>
					<td><input type="submit" value="修改" />
                    &nbsp;&nbsp;
				    <input type="reset" value="重置"></td>
				</tr>
			</table>
		</form>

	</s:else>
</body>
</html>